package icasue.net.socket.utils;

import icasue.net.base.annotations.NotNull;

import java.util.List;
import java.util.Objects;

/**
 * @Author: Qiao Hang
 * @CreateDate: 2021/5/18 下午5:44
 * @UpdateDate:
 * @Description:
 */
public class Cast {

    public static <T> List<T> castMulti(Object list, @NotNull Class<T> type){
        return Objects.isNull(list) || Objects.isNull(type)
                ? null : (List<T>) List.class.cast(list);
    }

    public static <T> T cast(Object item, @NotNull Class<T> type){
        return Objects.isNull(item) ? null : type.cast(item);
    }

}
